Skip to content

burn(bug): Fix ne/inequality operator in cmpToMC() for if-score contexts#38

Merged
bkmashiro merged 1 commit intomainfrom
burn/bug/9gh3dd/fix-ne-inequality-operator-in-cmptomc-fo
Apr 6, 2026
Merged

burn(bug): Fix ne/inequality operator in cmpToMC() for if-score contexts#38
bkmashiro merged 1 commit intomainfrom
burn/bug/9gh3dd/fix-ne-inequality-operator-in-cmptomc-fo

Conversation

@bkmashiro
Copy link
Copy Markdown
Owner

Task

  • ID: 01KNHK34QAPVBBSJS8J19GH3DD
  • Type: bug
  • Priority: 3
  • CLI: claude

Description

In src/emit/index.ts, the function cmpToMC() at line ~638 returns '=' for the 'ne' case, relying on callers to flip to 'unless'. However, the call site in call_if_score (line ~598) uses 'if score' context, meaning execute if score A = B is emitted instead of the correct execute unless score A = B. Fix by either: (a) adding a boolean parameter 'negate' to cmpToMC and returning the correct operator + prefix, or (b) having call_if_score detect 'ne' and emit 'unless score' instead of 'if score'. Add a test in the existing emit test suite that compiles a != comparison and asserts the generated .mcfunction contains 'unless score' not 'if score = '.

Changes

src/__tests__/emit/index.test.ts | 129 ++++++++++++++++++++++++++++++++++++++-
 src/emit/index.ts                |  29 +++++++--
 2 files changed, 152 insertions(+), 6 deletions(-)

Generated by burn-harness

@bkmashiro bkmashiro marked this pull request as ready for review April 6, 2026 16:25
@bkmashiro bkmashiro force-pushed the burn/bug/9gh3dd/fix-ne-inequality-operator-in-cmptomc-fo branch from b62fa9f to 2a70775 Compare April 6, 2026 16:25
@bkmashiro bkmashiro merged commit a37e582 into main Apr 6, 2026
@bkmashiro bkmashiro deleted the burn/bug/9gh3dd/fix-ne-inequality-operator-in-cmptomc-fo branch April 6, 2026 16:25
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant